#include "scene.h"
#include <stdlib.h>
#include <QSound>

scene::scene(QObject *parent) : QGraphicsScene(parent)
{
   int i=0;
   for(i=0;i<16;i++){
       this->items[i] = new item;
       this->items[i]->setPos(i/4*this->items[i]->boundingRect().width(),i%4*this->items[i]->boundingRect().height());
       this->addItem(this->items[i]);
   }

   this->ptimer = new QTimer;
   connect(this->ptimer,SIGNAL(timeout()),this,SLOT(showMouse()));
   this->ptimer->start(5000);
}
void scene::showMouse()
{
    int huifu;
    for(huifu=0;huifu<16;huifu++){
        this->items[huifu]->setPic(":/bg/pic/gaoshu.jpg");
        this->items[huifu]->setMouse(true);
    }
    //
    int num=rand()%16;
    this->items[num]->setMouse(false);
    this->items[num]->setPic(":/bg/pic/sqs.jpg");
    //
}
